Skip to content

Guard statusBarShow/statusBarHide against detached decorView#57120

Open
alanleedev wants to merge 1 commit into
react:mainfrom
alanleedev:export-D107934787
Open

Guard statusBarShow/statusBarHide against detached decorView#57120
alanleedev wants to merge 1 commit into
react:mainfrom
alanleedev:export-D107934787

Conversation

@alanleedev

Copy link
Copy Markdown
Contributor

Summary:
statusBarShow() and statusBarHide() access the window's decorView, which throws IllegalArgumentException when the decorView is not attached to the window manager. This can happen for extra windows (dialogs/popups) whose decorView is detached independently of the host activity's lifecycle, or when status bar visibility is updated during teardown.

Guard both functions with if (!decorView.isAttachedToWindow) return so the fix protects every caller at the source. The guard is a no-op during normal operation (the decorView is always attached) and only short-circuits during the teardown race.

Changelog:
[Android][Fixed] - Prevent IllegalArgumentException crash in statusBarShow/statusBarHide when the window decorView is detached

Differential Revision: D107934787

Summary:
`statusBarShow()` and `statusBarHide()` access the window's `decorView`, which throws `IllegalArgumentException` when the decorView is not attached to the window manager. This can happen for extra windows (dialogs/popups) whose decorView is detached independently of the host activity's lifecycle, or when status bar visibility is updated during teardown.

Guard both functions with `if (!decorView.isAttachedToWindow) return` so the fix protects every caller at the source. The guard is a no-op during normal operation (the decorView is always attached) and only short-circuits during the teardown race.

Changelog:
[Android][Fixed] - Prevent `IllegalArgumentException` crash in `statusBarShow`/`statusBarHide` when the window decorView is detached

Differential Revision: D107934787
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jun 9, 2026
@meta-codesync

meta-codesync Bot commented Jun 9, 2026

Copy link
Copy Markdown

@alanleedev has exported this pull request. If you are a Meta employee, you can view the originating Diff in D107934787.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. meta-exported p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant